<!doctype html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org/">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>问答首页</title>

    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="../static/css/article_list.css" th:href="@{/css/article_list.css}">
    <link rel="stylesheet" href="../static/admin/sweetalert/sweetalert.css" th:href="@{/admin/sweetalert/sweetalert.css}"/>
    <link rel="stylesheet" href="../static/css/public.css" th:href="@{/css/public.css}">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="../static/admin/sweetalert/sweetalert.min.js" th:src="@{/admin/sweetalert/sweetalert.min.js}"></script>
    <link rel="shortcut icon" href="../static/img/logo.png" th:href="@{/img/logo.png}" type="image/x-icon"/>

</head>
<body style="background-color: #f8f8f8;">
<!--navbar-->
<div th:replace="public.html::bbsheadnav('ask')"></div>


<div class="container">
    <br>
    <div th:if="${session.get('user')!=null}">
        <button style="border-color: #3c78d5;border: 1px solid;color: #fff;
    background-color: #4281de;border-radius: 999px;
    width: 70px;margin-left: 12px;" type="button" class="btn btn-success" data-toggle="modal" data-target="#myModal">提问
        </button>
    </div>
    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <form method="post" th:action="@{/ask/add}">
                    <div style="padding: 30px 30px;display: flex">
                        <img style="opacity: 0.8" width="65px" height="65px"
                             th:src="${session.user==null?'https://pic2.zhimg.com/v2-b7470680a324f715f9108de3dd9734e5_im.jpg':session.user.getImg()}"
                             alt="">

                        <div>

                            <input name="title" type="text" class="form-control" id="exampleInputPassword1"
                                   placeholder="写下你的问题">
                            <br>
                            <textarea name="detail" id="" cols="65" rows="10" placeholder="准确的描述问题更容易得到解答"></textarea>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button style="color: #fff;
    background-color: #467dcd;opacity: .5;border-color: #4a7ec9;" type="submit" class="btn btn-primary">发布问题
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <br>
    <div style="background: white;box-shadow: 0 1px 3px rgba(18,18,18,.1);">

        <div th:each="ask:${asks}" style="border-bottom: 1px solid #f6f6f6;padding: 15px 15px;margin-top: 10px">
            <img style="width: 20px;height:20px"
                 th:src="${ask.getUser().getImg()}"
                 class="img-circle">
            <span style="color: rgb(133, 144, 166);font-size: 15px;line-height: 20px">
                <span th:text="${ask.getUser().getName()}">GT君</span>&nbsp
                的提问期待你的解答 · <span
                    th:text="${#dates.format(ask.getAsk().getDate(),'yyyy年MM月dd日 HH:mm')}">2012年12月12日</span>
            </span>
            <div style="margin-top: 10px">
                <a th:href="@{'/ask/detail2/'+${ask.getAsk().getId()}}"
                   style="font-size: 18px;font-weight: 600;text-decoration: none;color: black;"
                   th:text="${ask.getAsk().getTitle()}">穷就算了，为啥我们还越来越忙？
                </a>
            </div>
            <div style="margin-top: 10px">
                <a th:href="@{'/ask/detail/'+${ask.getAsk().getId()}}">
                    <button style="background-color: #5185d7;color: #ffffff;border: #548ee3 solid 1px;width: 96px;
    height: 28px;line-height: 13px;border-radius: 3px;text-decoration: none" type="button" class="btn btn-default">
                        <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                        写回答
                    </button>
                </a>
                <a th:href="@{'/ask/detail2/'+${ask.getAsk().getId()}}"
                   style="text-decoration: none;color: #8590a6;;font-size: 15px;margin-left: 20px">
                    <span th:text="${ask.getRespCount()}">3 </span>&nbsp回答
                </a>
            </div>
        </div>
        <br>
    </div>
</div>
<div th:replace="public.html::bbsloginform"></div>
</body>
<script th:src="@{/js/snowfall.js}"></script>
<script th:src="@{/js/public.js}"></script>
</html>
